import SodaCommon from "../soda/SodaCommon";


export const GameGSState = {
    level: 0,
    score: 0,

    init(level = 0, score = 0) {
        this.level = level;
        if (level > 1) {
            this.score = (level - 1) * 2000;
        } else {
            this.score = 0;
        }
    },

    getLevel() {
        if (cc.sys.browserType == cc.sys.BROWSER_TYPE_WECHAT_GAME) {
            return SodaCommon.userData.guan;
        } else {
            return this.level;
        }
    },
    setLevel(level) {
        if (cc.sys.browserType !== cc.sys.BROWSER_TYPE_WECHAT_GAME) {
            this.level = level;
        }

        // F.GSPartner.sendEvent('关卡', {
        //     '类型': this.level
        // });
    },
    addLevel() {
        if (cc.sys.browserType !== cc.sys.BROWSER_TYPE_WECHAT_GAME) {
            this.level++;
        }

    },

    getScore() {
        return this.score;
    },
    setScore(score) {
        this.score = score;
    },
    addScore(score) {
        this.score += score;
    },

    getLevelDes() {
        if (cc.sys.browserType == cc.sys.BROWSER_TYPE_WECHAT_GAME) {
            return SodaCommon.userData.guan;

        } else {
            return this.level + 1 + '';
        }
    },

}